package com.jf.identity.controller;

import com.jf.identity.entity.*;
import com.jf.identity.service.VerifyInfoService;
import com.jf.identity.util.Params;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author FCG
 */
@RequestMapping("vis")
@RestController
public class VerifyInfoController {

    @Resource
    private VerifyInfoService verifyInfoService;

    @RequestMapping("set-identity-validateinfo")
    public ResponseBean setValidateInfo(@Validated @RequestBody VerifyInfoFeedBack verifyInfoFeedBack,
                                        BindingResult bindingResult) {
        Params.beanValidate(bindingResult);
        return new ResponseBean(verifyInfoService.insertVerifyInfo(verifyInfoFeedBack));
    }

    @RequestMapping("set-identity-validate-trailinfo")
    public ResponseBean setTrailInfo(@Validated @RequestBody VerifyAbnormalFeedBack verifyAbnormalFeedBack,
                                     BindingResult bindingResult) {
        Params.beanValidate(bindingResult);
        List<VerifyAbnormalInfo> infos
                = Params.isBlank(verifyAbnormalFeedBack.getValidateInfo(), "验证特征信息");
        return new ResponseBean(verifyInfoService.insertVerifyAbnormalInfo(infos));
    }

}














